<template>
  <div id='new_detail' style="height:100%">
    <view-box ref="viewBox" body-padding-top="50px" body-padding-bottom="50px">
      <x-header slot="header" :left-options="{backText: ''}" style="width:100%;position:absolute;left:0;top:0;z-index:100;" :title="title">
        <a href="./#/racelist" style="font-size:24px" slot="right">
          <i class="fa fa-home fa-fw"></i>
        </a>

      </x-header>

      <card :header="{title: '新闻正文' }">

        <div slot="content" class='procedure card-padding'>

          <div v-html="content" class="content">
            {{ $t('Custom content') }}
          </div>

        </div>

      </card>

      <!-- <scroller style="top:0px" lock-x  height='-200' scroll-bottom-offset='0' ref="scroller"> -->

      <!-- </scroller> -->

      <myFooter style="position: fixed;bottom: 0px;width:  100%;height:  50px;" :page="pageConfig"></myFooter>
    </view-box>

  </div>
</template>


<script type="text/ecmascript-6">
/* eslint-disable*/
const countTime = 60; //倒数计时60秒
import mixin from '@/common/js/mixin.js'
import Myheader from "@/common/components/myheader.vue";
import myFooter from "@/common/components/myfooter.vue";

import { cookie } from "vux";

import {
  Card,
  XHeader,
  Scroller,
  Divider,
  Spinner,
  ViewBox,
  Panel,
  debounce,
  XInput,
  Group,
  XButton,
  Grid,
  GridItem,
  FormPreview,
  Cell,
  LoadMore,
  Actionsheet,
  Toast,
  Confirm,
  TransferDomDirective as TransferDom
} from "vux";

import qs from "qs";
import { axios } from "@/api/axios.js";
import { indexedDB } from "@/api/indexedDB.js";

import { isIdNumber, setTitle } from "@/common/js/main.js";

export default {
  mixins: [mixin],
  props: ["page", "host"],
  data() {
    return {
      pageConfig: window.pageConfig,
      title: "",
      content: ""
    };
  },
  computed: {},
  beforeCreate() {
    console.log(typeof this.$route.query.page_id == "undefined");
    if (typeof this.$route.query.page_id == "undefined") {
      this.$router.push({ path: "newlist" });
    }
  },
  created() {
    this.pageId = this.$route.query.page_id;
    this.getNewInfo();
    
    //console.log(window.location.href);

  },
  mounted() {},
  methods: {
    getNewInfo() {
      axios.post(`${host}post/query`, qs.stringify({ id: this.pageId })).then(
        response => {
          if (response.status == "200") {
            this.content = response.data.content;
            this.title = response.data.subject;
            setTitle(this.title);
          }
        },
        error => {
          console.log(error);
        }
      );
    }
  },
  directives: {
    TransferDom
  },
  components: {
    Card,
    XHeader,
    Scroller,
    Divider,
    Spinner,
    ViewBox,
    Panel,
    debounce,
    XInput,
    Group,
    XButton,
    Grid,
    GridItem,
    FormPreview,
    Cell,
    LoadMore,
    Actionsheet,
    Toast,
    Myheader,
    Confirm,
    myFooter
  }
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="less" rel="stylesheet/less">
html,
body {
  height: 100%;
  width: 100%;
  overflow-x: hidden;
}
#new_detail .procedure {
  padding: 0;
}

.vux-header .vux-header-title > span {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#new_detail .weui-media-box__desc {
  position: relative;
  top: 15px;
}

#new_detail .footerBanner {
  display: none;
}

#new_detail .procedure .title {
  margin: 10px;
  width: auto;
}

#new_detail .procedure .title .top-title {
  text-align: center;
  font-weight: 400;
  // font-size: 17px;
  width: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-wrap: normal;
  word-wrap: break-word;
  word-break: break-all;
}

#new_detail .procedure img {
  width: 100%;
}

#new_detail .procedure .weui-media-box__info {
  margin-top: 15px;
  padding-bottom: 5px;
  font-size: 13px;
  color: #745e5e;
  line-height: 1em;
  list-style: none;
  overflow: hidden;
}

#new_detail .weui-media-box__info__meta_extra {
  padding-left: 1em;
  border-left: 1px solid #745e5e;
}

#new_detail .weui-media-box__info__meta {
  float: left;
  padding-right: 1em;
}

#new_detail .procedure .content {
  margin-bottom: 20px;
  overflow-x: hidden;
  overflow-y: scroll;
  height: 100%;
  padding-right: 15px;
  padding-left: 15px;
}

#new_detail .procedure .content p {
  margin: 10px 0 10px;
  white-space: normal;
  color: #666;
  font-size: 13px;
  line-height: 200%;
  // overflow: hidden;
  // text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  // -webkit-line-clamp: 2;
  // margin: 8px;
}

// #new_detail .procedure .content span {
//   color: #666;
//   font-size: 13px;
//   line-height: 160%;
//   margin: 10px;
// }

#new_detail .procedure .content .imgs {
  width: 100%;
  // height: 100px;
  display: table-cell;
  vertical-align: middle;
  // text-align: center;
  padding: 10px;
}

#new_detail .procedure .content img {
  width: 100%;
}

//h1标签
#new_detail .procedure {
  color: #666;
  box-sizing: border-box;
  h1 {
    font-weight: 500;
    line-height: 1.1;
    font-size: 36px;
    margin-bottom: 10px;
  }
  h2 {
    font-weight: 500;
    line-height: 1.1;
    font-size: 30px;
    margin-bottom: 10px;
  }
  h3 {
    font-weight: 500;
    line-height: 1.1;
    font-size: 24px;
    margin-bottom: 10px;
  }
  h4 {
    font-weight: 500;
    line-height: 1.1;
    font-size: 18px;
    margin-bottom: 10px;
  }
  h5 {
    font-weight: 500;
    line-height: 1.1;
    font-size: 14px;
    margin-bottom: 10px;
  }
  h6 {
    font-weight: 500;
    line-height: 1.1;
    font-size: 12px;
    margin-bottom: 10px;
  }
  ol,
  ul {
    color: #666;
    display: block;
    list-style-type: decimal;
    -webkit-margin-before: 1em;
    -webkit-margin-after: 1em;
    -webkit-margin-start: 0px;
    -webkit-margin-end: 0px;
    -webkit-padding-start: 40px;
  }
  li {
    display: list-item;
    text-align: -webkit-match-parent;
  }
  button {
    display: inline-block;
    padding: 4px 12px;
    margin-bottom: 0;
    font-size: 14px;
    line-height: 20px;
    text-align: center;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
    vertical-align: middle;
    cursor: pointer;
    background-image: linear-gradient(to bottom, #fff, #e6e6e6);
    background-repeat: repeat-x;
    border: 1px solid #ccc;
    border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
    border-bottom-color: #b3b3b3;
    border-radius: 4px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2),
      0 1px 2px rgba(0, 0, 0, 0.05);
    &:hover,
    &:focus {
      color: #333;
      text-decoration: none;
      background-position: 0 -15px;
      -webkit-transition: background-position 0.1s linear;
      -moz-transition: background-position 0.1s linear;
      -o-transition: background-position 0.1s linear;
      transition: background-position 0.1s linear;
    }
  }
  a {
    color: #666;
    text-decoration: none;
    line-height: 1.75;
    font-size: 14px;
    &:hover {
      color: #c81623;
    }
    strong {
      font-weight: 700;
    }
  }
}

//表格
// .procedure .content table {
//   word-break:break-all;
//   word-wrap: break-word;
//   margin: 0 auto;
//   width: 100%;
//   line-height: 40px;
//   position: relative;
//   // width: 100%;
//   border-collapse: collapse;
//   background-color: rgb(255, 255, 255);
//   display: table;
//   text-align: center;
//   vertical-align: middle;
// }

// .procedure .content th:nth-of-type(1) {
//   border-top: 1px solid #c7c7c7;
// }

// .procedure .content th {

//   position: relative;
//   border-right: 0;
//   border-bottom: 0;
//   border: 1px solid #c7c7c7;
//   text-align: center;
//   font-weight: 500;
//   display: table-cell;
//   vertical-align: inherit;
// }

// .procedure .content td {
//   text-align: center;
//   border-right: 1px solid #c7c7c7;
// }

// .procedure .content tr {
//   border: 1px solid #c7c7c7;
// }
#new_detail .procedure p {
  line-height: 1.5;
}
#new_detail .procedure table {
  width: 100%;
  max-width: 100%;
  white-space: pre;
  border-spacing: 0;
  border-collapse: collapse;
  word-break: break-all;
  word-wrap: break-word;
}

#new_detail .procedure table thead {
  display: table-header-group;
  vertical-align: middle;
  border-color: inherit;
}

#new_detail .procedure .tr {
  display: table-row;
  vertical-align: inherit;
  border-color: inherit;
}

#new_detail .procedure thead > tr > th {
  border-bottom-width: 2px;
  padding: 8px;
  line-height: 1.42857143;
  vertical-align: top;
  text-align: left;
  font-weight: bold;
  border: 1px solid #ddd;
  // display: table-cell;
}

#new_detail .procedure tbody {
  display: table-row-group;
  vertical-align: middle;
  border-color: inherit;
}

#new_detail .procedure tbody > tr > td {
  border: 1px solid #ddd;
  padding: 8px;
  line-height: 1.42857143;
  vertical-align: top;
  border-top: 1px solid #ddd;
}

#new_detail .procedure tbody > tr > th {
  border: 1px solid #ddd;
  text-align: left;
  padding: 8px;
}

#new_detail #content td p{
  margin: 0
}

// #newlist .weui-media-box__title{
//      position: relative;
//     top: 15px;
// }
</style>






